home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dejagnu.lha / dejagnu-1.0.1 / tcl / tests / split.test < prev    next >
Text File  |  1992-11-06  |  2KB  |  48 lines

  1. # Commands covered:  split
  2. #
  3. # This file contains a collection of tests for one or more of the Tcl
  4. # built-in commands.  Sourcing this file into Tcl runs the tests and
  5. # generates output for errors.  No output means no errors were found.
  6. #
  7. # Copyright 1991 Regents of the University of California
  8. # Permission to use, copy, modify, and distribute this
  9. # software and its documentation for any purpose and without
  10. # fee is hereby granted, provided that this copyright notice
  11. # appears in all copies.  The University of California makes no
  12. # representations about the suitability of this software for any
  13. # purpose.  It is provided "as is" without express or implied
  14. # warranty.
  15. #
  16. # $Header: /user6/ouster/tcl/tests/RCS/split.test,v 1.3 91/12/02 11:21:32 ouster Exp $ (Berkeley)
  17.  
  18. if {[string compare test [info procs test]] == 1} then {source defs}
  19.  
  20. test split-1.1 {basic split commands} {
  21.     split "a\n b\t\r c\n "
  22. } {a {} b {} {} c {} {}}
  23. test split-1.2 {basic split commands} {
  24.     split "word 1xyzword 2zword 3" xyz
  25. } {{word 1} {} {} {word 2} {word 3}}
  26. test split-1.3 {basic split commands} {
  27.     split "12345" {}
  28. } {1 2 3 4 5}
  29. test split-1.4 {basic split commands} {
  30.     split "a\}b\[c\{\]\$"
  31. } "a\\}b\\\[c\\{\\\]\\\$"
  32. test split-1.5 {basic split commands} {
  33.     split {} {}
  34. } {}
  35. test split-1.6 {basic split commands} {
  36.     split {}
  37. } {}
  38. test split-1.7 {basic split commands} {
  39.     split {   }
  40. } {{} {} {} {}}
  41.  
  42. test split-2.1 {split errors} {
  43.     list [catch split msg] $msg $errorCode
  44. } {1 {wrong # args: should be "split string ?splitChars?"} NONE}
  45. test split-2.2 {split errors} {
  46.     list [catch {split a b c} msg] $msg $errorCode
  47. } {1 {wrong # args: should be "split string ?splitChars?"} NONE}
  48.